package com.alibaba.crs.entity;
/**
 * @author GuoBin Hao
 * @version v1.0
 * @createDate 2021-03-31
 * 轿车子类
 */
public class Car extends MotorVehicle{
    /**
     * 无参构造
     */
    public Car() {
    }
    /**
     * 带参构造方法
     *
     * @param licenseNo 车牌号
     * @param brand     品牌
     * @param carType  型号
     * @param dailyRent 日租金
     */
    public Car(String licenseNo, String brand, String carType,double dailyRent) {
        super(licenseNo, brand,dailyRent);
        this.carType = carType;
    }
    /**
     * 型号
     */
    private String carType;

    public String getCarType() {
        return carType;
    }

    public void setCarType(String carType) {
        this.carType = carType;
    }

    /**
     * 计算汽车租赁的总租金
     * @param days 天数
     * @return 返回总租金
     */
    @Override
    public double calcRent(int days) {
        double total = 0.0;
        double discount;
        if(days > 150){
            discount = 0.7;
        }
        else if(days > 30){
            discount = 0.8;
        }
        else if(days > 5){
            discount = 0.9;
        }
        else{
            discount = 1;
        }
        total = days * super.getDailyRent() * discount;
        return total;
    }


}
